package com.tanhua.server.service;


import com.tanhua.domain.db.SoulAnswer;
import com.tanhua.domain.vo.ReportVo;
import com.tanhua.domain.vo.SoulTestVo;
import com.tanhua.dubbo.api.SoulTestApi;
import com.tanhua.server.Interceptor.UserHolder;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SoulService {
   @Reference
    private SoulTestApi testSoulApi;
    public ResponseEntity getSoulList() {
      List<SoulTestVo> list=testSoulApi.getTestList(UserHolder.getUserId());
      return ResponseEntity.ok(list);
    }

    public ResponseEntity saveSoulList(List<SoulAnswer> answers) {
         String reportId= testSoulApi.saveSoulList(answers,UserHolder.getUserId());
         return ResponseEntity.ok(reportId);
    }

    public ResponseEntity getReport(String id) {
       ReportVo reportVo= testSoulApi.getReport(id);
       return ResponseEntity.ok(reportVo);
    }
}
